export default class ButtonAction {
    constructor(comp) {
        this.comp = comp;
    }

    // 第一次进页面的按钮状态
    updateButtonStatus = () => {
        const {props} = this.comp;
        const {button, main} = props;
        const {isEdit, orgValue} = main;
        button.setButtonVisible({
            edit: !isEdit,
            save: isEdit,
            cancel: isEdit
        });
    };

    // 按钮点击回调
    headerClick = async (props, btnCode) => {
        const {action} = this.comp;
        switch (btnCode) {
            case 'edit':
                action.tableAct.edit();
                break;
            case 'save':
                action.tableAct.beforeSave();
                break;
            case 'cancel':
                action.tableAct.cancel();
                break;
            default:
                break;
        }
    };

    // 人力组织改变
    // changeOrg = async (value) => {
    //     const {props, action} = this.comp;
    //     const {dispatch} = props;

    //     await dispatch({
    //         type: 'main/update',
    //         payload: {
    //             orgValue: value
    //         }
    //     });
    //     action.treeAct.getTreeData();
    //     this.updateButtonStatus();
    // };
}